/**
 * 
 */
package org.lookouster.nextAgadir.pointageBureau.outils;

import org.lookouster.nextAgadir.pointageBureau.bases.LocalisationGPS;

/**
 * @author Lookouster
 *
 */
public class Cote {
	
	/**
	 * Represents a field's Vertex
	 * @author Lookouster
	 *
	*/
		private double coefDir, ordOrg;
		LocalisationGPS point1, point2;
		public Cote(LocalisationGPS d, LocalisationGPS f)
		{
			point1=d;
			point2=f;
			coefDir=(point1.getY()-point2.getY())/(point1.getX()-point2.getX());
			ordOrg=point2.getY()-coefDir*point2.getX();
		}
		
		public double equationResultat(LocalisationGPS l)
		{
			return l.getY()-coefDir*l.getX()-ordOrg;
		}
		
		public boolean passBy(LocalisationGPS l)
		{
			if(equationResultat(l)==0)
			{
				if((point1.getX()<=l.getX() && point2.getX()>=l.getX()) 
						|| (point1.getX()>=l.getX() && point2.getX()<=l.getX()))
					return true;
				return false;
			}
			return false;
		}

		/**
		 * @return the coefDir
		 */
		public double getCoefDir() {
			return coefDir;
		}

		/**
		 * @param coefDir the coefDir to set
		 */
		public void setCoefDir(double coefDir) {
			this.coefDir = coefDir;
		}

		/**
		 * @return the ordOrg
		 */
		public double getOrdOrg() {
			return ordOrg;
		}

		/**
		 * @param ordOrg the ordOrg to set
		 */
		public void setOrdOrg(double ordOrg) {
			this.ordOrg = ordOrg;
		}

		/**
		 * @return the point1
		 */
		public LocalisationGPS getPoint1() {
			return point1;
		}

		/**
		 * @param point1 the point1 to set
		 */
		public void setPoint1(LocalisationGPS point1) {
			this.point1 = point1;
		}

		/**
		 * @return the point2
		 */
		public LocalisationGPS getPoint2() {
			return point2;
		}

		/**
		 * @param point2 the point2 to set
		 */
		public void setPoint2(LocalisationGPS point2) {
			this.point2 = point2;
		}
		
		
	}
